﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using WP8_PPS.Models;

namespace WP8_PPS.Helpers
{
    /// <summary>
    /// Converter to convert from a selection of an enumeration of PoleCondition to a string and back
    /// </summary>
    public class SinglePoleConditionConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return value.ToString();
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return EnumExtensions.GetEnum<PoleCondition>(value.ToString());
        }
    }
}
